using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using PressMenu2;

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    CMenu menu;
    CNewGame newGame;
    COptionGame optionGame;
    


    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        graphics.PreferredBackBufferHeight = cDef.WindowHeight;
        graphics.PreferredBackBufferWidth = cDef.WindowWidth;
        Content.RootDirectory = "Content";
    }

    protected override void Initialize()
    {
        menu = new CMenu();
        newGame = new CNewGame();
        optionGame = new COptionGame();
        
        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        menu.LoadContent( Content);
        newGame.LoadContent(Content);
        optionGame.LoadContent(Content);
    }

    protected override void UnloadContent()
    {
    }


    protected override void Update(GameTime gameTime)
    {
        if (CManager.Show == 0)
            menu.Update(this);
            
            if (CManager.Show==1)
                newGame.Update(gameTime, this);
            /*else
                if (CManager.Show < 3)
                {
                    optionGame.Update();
                }*/
        
            
        //newGame.Update(gameTime, this);
        //optionGame.Update();
        
        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();
        if (CManager.Show < 1)
            menu.Draw(spriteBatch);
        else
        {
            if (CManager.Show < 2)
                newGame.Draw(spriteBatch);
            else
                if (CManager.Show < 3)
                    optionGame.Show(spriteBatch);
        }
        
        //newGame.Draw(spriteBatch);
        //menu.Draw(spriteBatch);
        //optionGame.Show(spriteBatch);
        spriteBatch.End();
        base.Draw(gameTime);
    }
}

